wsd: Report FUSE block counts - #6
Merged
Merged
Conversation
Populate FUSE stat block metadata so st_blocks consumers such as du see non-zero usage for files on the mount. The driver now preserves provider-supplied block fields and derives them for pending or buffered in-memory stats. Add regression coverage for persisted, empty, pending-create, and dirty buffered files. Document the setup traps around fuse-native builds, clean-checkout test builds, and privileged real-FUSE tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every file and directory on the
wsdFUSE mount reports zero disk usage. Writing twelve bytes and askingdufor the size returns0:This is not a
dubug.dureadsst_blocksfromstat(2), notst_size, and the FUSE driver was leavingst_blocksempty. Thegetattrpath built its stat result without theblocksandblksizefields, so the kernel saw zero allocated blocks for every inode on the mount.The fix populates both fields wherever the driver builds a stat.
st_blockscounts allocation in fixed 512-byte units, the unit POSIX defines for that field regardless of the filesystem's logical block size, so a 513-byte file occupies two blocks and an empty file occupies none.st_blksizeis the preferred input/output size, a separate value that stays at4096to match whatstatfsalready advertises and what the backing virtual filesystem reports. The backing filesystem already supplies both fields for files written to disk, so the driver passes those through and only derives the values for the in-memory cases: a freshly created file before its first flush, and a file whose buffered size has outrun the size on disk.Reviewers with a privileged FUSE-capable container can verify the behavior against a real mount:
The regression tests cover the same block accounting without requiring a mount. They assert block counts for a 513-byte file, an empty file, a freshly created file that has not flushed, and a file whose buffered size has grown past a block boundary before flush. These tests fail against the old stat shape because
blocksandblksizeare missing, and pass with this change.This also updates the setup documentation around running the tests from a clean container.
AGENTS.mdnow calls out the native build toolsfuse-nativeneeds, the Linux arm64 libfuse swap needed when the package's bundled x64 library cannot link, the need to build sibling package output before running tests, and the different gates used by the two real-FUSE test suites. Thepackages/wsdREADME no longer claims that its test script builds first or uses Node's type stripping; it describes the Vitest command, the required build output, and the difference between the/dev/fuse-guarded CLI test and the Docker-backed real-FUSE runner test.